package com.zrrd.exam;

import java.util.ArrayList;

/**
 * @author ywb
 * @Description:
 * @date 2023/4/13 19:34
 */
public class three {
    public static int[] fun (int n) {
        int m = n;
        ArrayList<Integer> a = new ArrayList<>();
        for (int i = 0; i < n*(n+1)/2; i++) {
            int k = m - 1;
            a.add(i,m);
            i++;
            while (k--> 0){
                a.add(i,m-1);
                i++;
                a.add(i,m);
                i++;
            }
            i--;
            m-=2;
        }
     int[] res = new int[a.size()];
        for (int i = 0; i < a.size(); i++) {
            res[i] = a.get(i);
        }
        return res;
    }

    public static void main(String[] args) {
        int[] a = fun(3);
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i]);
        }
    }
}
